#include "cmd.h"

// #include "heartbeat.h"
// #include "testlogin.h"

namespace base {

	CMDMapping::CMDMapping()
	{
// 		_cmds[BASE_CMD_HEARTBEAT] = new HeartBeat;
// 		_cmds[BASE_CMD_LOGIN] = new PlayerLogin;
	}


	CMDMapping::~CMDMapping()
	{
		std::map<unsigned short, Protocol *>::iterator it = _cmds.begin();
		while (it != _cmds.end()) {
			Protocol* p = it->second;
			if (NULL != p) {
				delete p;
				p = NULL;
			}
			it++;
		}
		_cmds.clear();
	}

	void CMDMapping::addProtocol()
	{

	}

	Protocol* CMDMapping::getProtocol( unsigned short cmdType )
	{
		return _cmds[cmdType];
	}

}	// namespace base
